<%@ Page Language="C#" MasterPageFile="~/Admin/AdminMasterPage.master" MaintainScrollPositionOnPostback="true"
    AutoEventWireup="true" CodeFile="AddNewProviderCompany.aspx.cs" Inherits="Admin_provider_AddNewProviderCompany"
    Title="Provider Company Information - ComparExpress Admin" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

    <script src="../includes/color_codes.js" type="text/javascript"></script>

    <style type="text/css">
        .PaletteMouseOver
        {
            border: solid 1px #ffffff;
        }
        .PaletteMouseOut
        {
            border: solid 1px #000000;
        }
    </style>
    <div class="contents">
        <table width="100%" cellpadding="3" cellspacing="0" border="0">
            <tr>
                <td colspan="2">
                    <h1>Provider Company</h1>
                    <asp:Label ID="lblProviderCompanyId" runat="server" Visible="false"></asp:Label>
                </td>
            </tr>
            <tr>
                <td>
                    Company Name
                </td>
                <td>
                    <asp:TextBox ID="txtCompanyName" runat="server" Width="250px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvCompanyName" runat="server" ControlToValidate="txtCompanyName"
                        Display="Dynamic" ErrorMessage="Require Company Name" 
                        ValidationGroup="providercompany">*</asp:RequiredFieldValidator>
                    <asp:RequiredFieldValidator ID="rfvSearchCompanyName" runat="server" ControlToValidate="txtCompanyName"
                        Display="Dynamic" ErrorMessage="*" ValidationGroup="checkname">*</asp:RequiredFieldValidator>
                    <asp:Button ID="btnCheck" runat="server" OnClick="btnCheck_Click" Text="Search" ValidationGroup="checkname" />
                    <asp:Button ID="btnViewList" runat="server" OnClick="btnViewList_Click" Text="View List" />
                    <asp:Label ID="lblSearchMessage" runat="server" Text=""></asp:Label>
                </td>
            </tr>
            <tr>
                <td>
                    Business/Industry Type
                </td>
                <td>
                    <asp:DropDownList ID="ddlBusIndType" runat="server">
                        <asp:ListItem Value="-1">Select</asp:ListItem>
                        <asp:ListItem>Construction</asp:ListItem>
                        <asp:ListItem>Manufacturing</asp:ListItem>
                        <asp:ListItem>Information Technology</asp:ListItem>
                        <asp:ListItem>Education</asp:ListItem>
                        <asp:ListItem>Entertainment</asp:ListItem>
                        <asp:ListItem>Health Care</asp:ListItem>
                        <asp:ListItem>Motor Vehicles</asp:ListItem>
                        <asp:ListItem>Tele Communication</asp:ListItem>
                        <asp:ListItem>Others</asp:ListItem>
                    </asp:DropDownList>
                    <asp:RequiredFieldValidator
                        ID="rfvBusIndType" runat="server" ControlToValidate="ddlBusIndType" Display="Dynamic"
                        ErrorMessage="Select Business/Industry Type." 
                        ValidationGroup="providercompany" InitialValue="-1">*</asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td valign="top">
                    Company Type
                </td>
                <td>
                    <asp:DropDownList ID="ddlCompanyType" runat="server">
                        <asp:ListItem Value="-1">Select</asp:ListItem>
                        <asp:ListItem>Private Limited</asp:ListItem>
                        <asp:ListItem>Multinational Corporation</asp:ListItem>
                        <asp:ListItem>Small and Medium Enterprise</asp:ListItem>
                        <asp:ListItem>Government Ministry</asp:ListItem>
                        <asp:ListItem>Statutory Board</asp:ListItem>
                        <asp:ListItem>Public Listed</asp:ListItem>
                        <asp:ListItem>Partnership</asp:ListItem>
                        <asp:ListItem>Sole Proprietor</asp:ListItem>
                        <asp:ListItem>Non-Profitable Organization</asp:ListItem>
                        <asp:ListItem>Others</asp:ListItem>
                    </asp:DropDownList>
                    <asp:RequiredFieldValidator
                        ID="rfvCompanyType" runat="server" ControlToValidate="ddlCompanyType" Display="Dynamic"
                        ErrorMessage="Select Company Type." ValidationGroup="providercompany" 
                        InitialValue="-1">*</asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td valign="top">
                    Color Code
                </td>
                <td>
                    <div style="width: 20%; height: 20px; border: solid 1px" id="divCurrentColor"></div>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                </td>
                <td>
                    R :&nbsp;<asp:TextBox ID="txtRed" runat="server" MaxLength="3" Width="40px"></asp:TextBox>
                    &nbsp;G:
                    <asp:TextBox ID="txtGreen" runat="server" MaxLength="3" Width="40px"></asp:TextBox>
                    &nbsp;B:
                    <asp:TextBox ID="txtBlue" runat="server" MaxLength="3" Width="40px"></asp:TextBox>
                    &nbsp;<asp:Button ID="btnSetRGB" runat="server" Text="Set" />
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                </td>
                <td>
                    Hex : <b>#</b><asp:TextBox ID="txtHex" runat="server" MaxLength="6" Width="100px"></asp:TextBox>
                    <asp:Button ID="btnSetHex" runat="server" Text="Set" />
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                </td>
                <td>
                    <table style="border: solid 1px #000000;">
                        <tr>
                            <td>
                                <script type="text/javascript">DrawPalette();</script>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td valign="top">
                    Provider Type
                </td>
                <td>
                    <asp:CheckBoxList ID="cblProviderType" runat="server"></asp:CheckBoxList>
                </td>
            </tr>
            <tr>
                <td valign="top">
                    Phone Number 1
                </td>
                <td>
                    <asp:TextBox ID="txtPhoneNo1" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator
                        ID="rfvPhoneNumber1" runat="server" ControlToValidate="txtPhoneNo1" Display="Dynamic"
                        ErrorMessage="Require Phone Number 1." ValidationGroup="providercompany">*</asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td valign="top">
                    Phone Number 2
                </td>
                <td>
                    <asp:TextBox ID="txtPhoneNo2" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td valign="top">
                    Fax No 1
                </td>
                <td>
                    <asp:TextBox ID="txtFaxNo1" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td valign="top">
                    Fax No 2
                </td>
                <td>
                    <asp:TextBox ID="txtFaxNo2" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td valign="top">
                    Email 1
                </td>
                <td>
                    <asp:TextBox ID="txtEmail1" runat="server" class="text" 
                        ValidationGroup="providercompany" Width="250px"></asp:TextBox>
                    <asp:RequiredFieldValidator
                        ID="rfvEmail1" runat="server" ControlToValidate="txtEmail1" Display="Dynamic"
                        ErrorMessage="Require Email address" ValidationGroup="providercompany">*</asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="revEmail1" runat="server" ControlToValidate="txtEmail1"
                        ErrorMessage="Invalid Email address." ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                        ValidationGroup="providercompany">*</asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td valign="top">
                    Email 2
                </td>
                <td>
                    <asp:TextBox ID="txtEmail2" runat="server" class="text" Width="250px"></asp:TextBox>
                    <asp:RegularExpressionValidator ID="revEmail2" runat="server" ControlToValidate="txtEmail2"
                        ErrorMessage="Invalid Email address 2" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                        ValidationGroup="providercompany">*</asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td valign="top">
                    Web Site URL 1
                </td>
                <td>
                    <asp:TextBox ID="txtURL1" runat="server" MaxLength="255" Width="250px"></asp:TextBox>
                    <asp:RegularExpressionValidator ID="revWebSite1" runat="server" ControlToValidate="txtURL1"
                        ErrorMessage="Invalid URL 1." ValidationExpression="http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?"
                        ValidationGroup="providercompany">*</asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td valign="top">
                    Web Site URL 2
                </td>
                <td>
                    <asp:TextBox ID="txtURL2" runat="server" Width="250px"></asp:TextBox>
                    <asp:RegularExpressionValidator ID="revWebSite2" runat="server" ControlToValidate="txtURL2"
                        ErrorMessage="Invalid URL 2." ValidationExpression="http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?"
                        ValidationGroup="providercompany">*</asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td valign="top">
                    Postcode
                </td>
                <td>
                    <asp:TextBox ID="txtPostCode" runat="server" MaxLength="6" Width="70px"></asp:TextBox>
                    <asp:RequiredFieldValidator
                        ID="rfvEmail0" runat="server" ControlToValidate="txtPostCode" Display="Dynamic"
                        ErrorMessage="Require Post Code." ValidationGroup="providercompany">*</asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" 
                        ControlToValidate="txtPostCode" ErrorMessage="Post code is not valid." 
                        ValidationExpression="\d{6}" ValidationGroup="providercompany">*</asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td valign="top">
                    Unit No
                </td>
                <td>
                    <asp:TextBox ID="txtUnitNo1" runat="server" MaxLength="5" Width="50px"></asp:TextBox>-<asp:TextBox ID="txtUnitNo2"
                        runat="server" MaxLength="5" Width="50px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td valign="top">
                    Street
                </td>
                <td>
                    <asp:TextBox ID="txtStreet" runat="server" Width="250px"></asp:TextBox>
                    <asp:RequiredFieldValidator
                        ID="rfvStreet" runat="server" ControlToValidate="txtStreet" Display="Dynamic"
                        ErrorMessage="Require Post Code." ValidationGroup="providercompany">*</asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td valign="top">
                    City
                </td>
                <td>
                    <asp:TextBox ID="txtCity" runat="server" Width="200px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td valign="top">
                    Country
                </td>
                <td>
                    <asp:DropDownList ID="ddlCountry" runat="server">
                        <asp:ListItem Value="-1">Select</asp:ListItem>
                        <asp:ListItem Value="Singapore">Singapore</asp:ListItem>
                        <asp:ListItem Value="Malaysia">Malaysia</asp:ListItem>
                        <asp:ListItem Value="Myanmar" >Myanmar</asp:ListItem>
                        <asp:ListItem Value="Thailand">Thailand</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td valign="top">
                    &nbsp;</td>
                <td>
                    <asp:ValidationSummary ID="vsprovidercompany" runat="server" ValidationGroup="providercompany" />
                    <asp:Label ID="lblMessage" runat="server" Font-Bold="True"></asp:Label>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Button ID="btnBack" runat="server" OnClick="btnBack_Click" OnClientClick="return confirm('Are your sure to go back?');"
                        Text="Back" CssClass="btn green" />
                </td>
                <td><asp:Button ID="btnClearForm" runat="server" CausesValidation="False" OnClick="btnClearForm_Click"
                        OnClientClick="return confirm('Are you sure to clear form?');" CssClass="btn blue" Text="Clear" /> 
                    
                    <asp:Button ID="btnAddNew" runat="server" OnClick="btnAddNew_Click" OnClientClick="return confirm('Are you sure to add new provider?');"
                        Text="Submit" ValidationGroup="providercompany" CssClass="btn blue" />
                    
                </td>
            </tr>
            <tr>
                <td>&nbsp;
                </td>
                <td>
                    &nbsp;</td>
            </tr>
        </table>
    </div>

    <script type="text/javascript">
    function ChangeColors(r,g,b)
    {
        //alert(formName);
        var txtR = document.getElementById('<%=txtRed.ClientID%>');
        var txtG = document.getElementById('<%=txtGreen.ClientID%>');
        var txtB = document.getElementById('<%=txtBlue.ClientID%>');
        var txtHex = document.getElementById('<%=txtHex.ClientID%>');
        var divCurrentColor = document.getElementById('divCurrentColor');
        if (r>255) r=255;
        if (g>255) g=255;
        if (b>255) b=255;
        if (r<0) r=0;
        if (g<0) g=0;
        if (b<0) b=0;
        if(!(r>=0)&&!(r<=255)) r=0
        if(!(g>=0)&&!(g<=255)) g=0
        if(!(b>=0)&&!(b<=255)) b=0
        RGB.R=r;
        RGB.G=g;
        RGB.B=b;
        txtR.value = r;
        txtG.value = g;
        txtB.value = b;
        txtHex.value = HEXCodes[r]+HEXCodes[g]+HEXCodes[b];
        divCurrentColor.style.backgroundColor = "#"+HEXCodes[r]+HEXCodes[g]+HEXCodes[b];
        //document.getElementById(formName).r.value=r;
        //document.getElementById(formName).g.value=g;
        //document.getElementById(formName).b.value=b;
        //document.getElementById(formName).hex.value=HEXCodes[r]+HEXCodes[g]+HEXCodes[b];
        //document.getElementById('currentColor').style.backgroundColor="#"+HEXCodes[r]+HEXCodes[g]+HEXCodes[b];

	    //DrawWheel();
    }
    function LoadColor()
    {
        var txtR = document.getElementById('<%=txtRed.ClientID%>');
        var txtG = document.getElementById('<%=txtGreen.ClientID%>');
        var txtB = document.getElementById('<%=txtBlue.ClientID%>');
        
        if(txtR.value.length == 0 || txtG.value.length == 0 || txtB.value.length == 0)
        {
            txtR.value = 255;
            txtG.value = 255;
            txtB.value = 255;
        }
        
        ChangeColors(txtR.value, txtG.value, txtB.value);
    }

    LoadColor();
    </script>

</asp:Content>
